#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QDialog* dialog=new QDialog(this);
    dialog->setWindowTitle("对话框的标题");
    //设置对话框大小
    dialog->resize(400,300);
    //通过show方法可以显示对话框
    dialog->show();

    //delete dialog;
    dialog->setAttribute(Qt::WA_DeleteOnClose);
}
